package com.project.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.project.bean.LogBean;
import com.project.service.ILogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.time.LocalDate;
import java.util.List;

@RequestMapping("log")
@RestController
public class LogController {
    @Autowired
    private ILogService logService;

    @RequestMapping("findByItem")
    public IPage<LogBean> findByItem(Integer pageNO, LocalDate startDate, LocalDate endDate){
        return logService.findByItem(pageNO, startDate, endDate);
    }

    @RequestMapping("addLog")
    public String addLog(LogBean logBean){
        logService.addLog(logBean);
        return "success";
    }

    @RequestMapping("showAllLog")
    public List<LogBean> showAllLog(){
        return logService.showAllLog();
    }
}
